var info_content = new Vue({
    el: "#info_content",
    data:{
        type:"",
        pageSize: 5,
        pageNo: 1,
        menuCol:false,
        infoUrl:"api/sys/info/listInfo?type=",
        information:{
            "otherData":{
                "menuColStr":""
            }
        },
        menuUrl: "api/sys/index/menuCol",
        menuData:{},
        sideUrl: "api/sys/info/getSideEdge",
        sideDate:{}
    },
    mounted:function () {
        this.setPageType();//获取当前链接类型
        this.getInfoContent();
        menu_hover();
    },
    methods: {
        setPageType:function(){
            this.type = this.getQueryString('type');
            this.menuCol = this.getQueryString('menuCol')||false;
            var name = this.type == 5?"经纪团队-":this.type == 2?"咨询百科-":"新闻动态-";
            $("title").html(name+"-"+$("title").html());
        },
        getQueryString:function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        },
        getInfoContent:function () {
            this.$http.get(baseUrl + this.infoUrl + this.type + '&pageSize=' + this.pageSize + '&pageNo='+this.pageNo+(this.menuCol?('&menuCol='+this.menuCol):'')).then(
                function (res) {
                    this.information = res.data.data;
                    this.toTop();
                }
            ).catch(function (response) {
                console.log(response)
            })

            this.$http.get(baseUrl + this.sideUrl).then(
                function (res) {
                    this.sideDate = res.data.data;
                }
            ).catch(function (response) {
                console.log(response)
            })

            this.$http.get(baseUrl + this.menuUrl).then(
                function (res) {
                    this.menuData = res.data.data;
                }
            ).catch(function (response) {
                console.log(response)
            })
        },
        pageQuery:function (pageNo) {
            if(pageNo == this.pageNo){
                return;
            }
            this.pageNo = pageNo;
            this.getInfoContent();
        },
        toTop:function () {
            $('html,body').animate({scrollTop: '0px'}, 800);
        }
    },
    filters: {
        formatDate: function (val) {
            var value = new Date(val);
            var year = value.getFullYear();
            var month = padDate(value.getMonth() + 1);
            var day = padDate(value.getDate());
           /* var hour = padDate(value.getHours());
            var minutes = padDate(value.getMinutes());
            var seconds = padDate(value.getSeconds());*/
            return year + '/' + month + '/' + day ;
        }
    }
})